import { request } from './request.js'
request.defaultData.baseUrl = 'http://cyjs.pzhkj.cn/'

export function getTrendChart({ caipiao_id = 0, qishu = 0 } = {}) {
  return new Promise((resolve, reject) => {
    request
      .ajax({
        path: 'api/lottery/zoushi',
        method: 'POST',
        data: {
          caipiao_id,
          qishu,
        },
        afterAjax: res => {
          resolve(res)
        },
      })
      .catch(err => {
        reject(err)
      })
  })
}

// 下一期开奖时间
export function getNextKj({ caipiao_id = 0 } = {}) {
  return new Promise((resolve, reject) => {
    request
      .ajax({
        path: 'api/index/getNextKj',
        method: 'POST',
        data: {
          caipiao_id,
        },
        afterAjax: res => {
          resolve(res)
        },
      })
      .catch(err => {
        reject(err)
      })
  })
}
